﻿
// FileOrgDlg.cpp : 实现文件
//

#include "stdafx.h"
#include "FileOrg.h"
#include "FileOrgDlg.h"
#include "afxdialogex.h"
////
#include <locale.h>
#include "rawTextFile.h"
/*
// 【TODO】
// 
// [√已完成]  1.将文件的大小信息，大小总计信息，写入到文件。
//               ---以K,M,G,的形式显示，而非byte的方式显示.
// 
// Bug1. 如果_flist.csv当前是打开的，则写入时会出错。有Assert异常。
// 
// 【改动】
// 1601. 写文件时，进度条的显示逻辑改为两个点。
//       -- 比有nSize个点的时候，速度要快很多。非常多.
//       2016年10月20日16:53:41
// 1602.增加输出文件大小信息,对文件大小进行统计并输出的功能. 2016年10月21日11:33:29
// 
*/
#ifdef _DEBUG
#define new DEBUG_NEW
#endif

namespace 
{

#define  kstrDefPath _T("D:\\pcSet\\lidSync\\")
#define  kstrFilter _T("LIBINI文件 (*.myini)|*.myini||")

	static HANDLE  static_hCopyThread = NULL;
	static CString static_LastCheckSizeFolder = _T("");
	//需要拷贝的列表//
	lid::FileNodePtrList copyList;
	DWORD _stdcall pfnCopyThreadProc(LPVOID lpParameter)  //线程函数
	{
		CFileOrgDlg *pDlg = (CFileOrgDlg*) lpParameter;
		bgFileChecker fc;
		pDlg->_todo.SetRange(1,copyList.size());
		int iPos = 1;
		pDlg->_todo.SetPos(iPos);
		for(lid::FileNodePtrListIter iter = copyList.begin(); iter !=  copyList.end(); ++iter)
		{
			lid::FileNodeType* copyItemData = (lid::FileNodeType*)(*iter);
			fc.set_filePathFull(copyItemData->orginName);
			fc.shell_copyFileTo(pDlg,copyItemData->reAsignName);
			pDlg->_todo.SetPos(iPos);
			iPos++;
		}
		pDlg->_baseListBox.InsertString(-1,_T("输出: 拷贝完成!"));
		pDlg->_lidfc.clearFileNodeList(&copyList);
		return 0;
	}


}

// 用于应用程序“关于”菜单项的 CAboutDlg 对话框

class CAboutDlg : public CDialogEx
{
public:
	CAboutDlg();

	// 对话框数据
	enum { IDD = IDD_ABOUTBOX };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持

	// 实现
protected:
	DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialogEx(CAboutDlg::IDD)
{
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
END_MESSAGE_MAP()


// CFileOrgDlg 对话框




CFileOrgDlg::CFileOrgDlg(CWnd* pParent /*=NULL*/)
	: CDialogEx(CFileOrgDlg::IDD, pParent)
{
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CFileOrgDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_EDIT_FPATH, _fPathRomeo);
	DDX_Control(pDX, IDC_EDIT_FPATH2, _fpathJuliet);
	DDX_Control(pDX, IDC_LIST_ROMEO, _baseListBox);
	DDX_Control(pDX, IDC_PROGRESS, _todo);
	DDX_Control(pDX, IDC_BTN_REMOVE_DUPY, _btnRemoveDupy);
}

BEGIN_MESSAGE_MAP(CFileOrgDlg, CDialogEx)
	ON_WM_SYSCOMMAND()
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	ON_BN_CLICKED(IDC_BTN_RENAME_TEST, &CFileOrgDlg::OnBnClickedRenameTest)
	ON_WM_DESTROY()
	ON_BN_CLICKED(IDC_BTN_SEL_LIBINI, &CFileOrgDlg::OnBnClickedBtnSelLibini)
	ON_BN_CLICKED(IDC_BTN_SEL_LIBINI2, &CFileOrgDlg::OnBnClickedBtnSelLibini2)
	ON_BN_CLICKED(IDC_BTN_SWITCH, &CFileOrgDlg::OnBnClickedBtnSwitch)
	ON_BN_CLICKED(IDC_BTN_RENAME_TEST_Ju, &CFileOrgDlg::OnBnClickedBtnRenameTestJuliet)
	ON_BN_CLICKED(IDC_BTN_DETECT_PART_ADD, &CFileOrgDlg::OnBnClickedBtnDetectPartAdd)
	ON_BN_CLICKED(IDC_BTN_UPDATE_PARTNAME, &CFileOrgDlg::OnBnClickedBtnUpdatePartname)
	ON_BN_CLICKED(IDC_BTN_SYNC_BFILE2A, &CFileOrgDlg::OnBnClickedBtnSyncBfile2a)
	ON_BN_CLICKED(IDC_OPEN_AFOLDER, &CFileOrgDlg::OnBnClickedOpenAfolder)
	ON_BN_CLICKED(IDC_OPEN_BFOLDER, &CFileOrgDlg::OnBnClickedOpenBfolder)
	ON_BN_CLICKED(IDC_BTN_FIND_SAME_SIZE, &CFileOrgDlg::OnBnClickedBtnFindSameSize)
	ON_BN_CLICKED(IDC_BTN_REMOVE_DUPY, &CFileOrgDlg::OnBnClickedBtnRemoveDupy)
	ON_BN_CLICKED(IDC_WRITEFILE, &CFileOrgDlg::OnBtn_write2file)
END_MESSAGE_MAP()


// CFileOrgDlg 消息处理程序

BOOL CFileOrgDlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	lid::FormatBytes64InternalAutoUnit(89673015);
	

	// 将“关于...”菜单项添加到系统菜单中。

	// IDM_ABOUTBOX 必须在系统命令范围内。
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);

	CMenu* pSysMenu = GetSystemMenu(FALSE);
	if (pSysMenu != NULL)
	{
		BOOL bNameValid;
		CString strAboutMenu;
		bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
		ASSERT(bNameValid);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}

	// 设置此对话框的图标。当应用程序主窗口不是对话框时，框架将自动
	//  执行此操作
	SetIcon(m_hIcon, TRUE);			// 设置大图标
	SetIcon(m_hIcon, FALSE);		// 设置小图标

	_fPathRomeo.SetWindowText(_lidfc.IniFilePath);
	_btnRemoveDupy.EnableWindow(FALSE);
	_wsetlocale(LC_ALL,L"chs");  //设置成中文
	// TODO: 在此添加额外的初始化代码

	return TRUE;  // 除非将焦点设置到控件，否则返回 TRUE
}

void CFileOrgDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
	if ((nID & 0xFFF0) == IDM_ABOUTBOX)
	{
		CAboutDlg dlgAbout;
		dlgAbout.DoModal();
	}
	else
	{
		CDialogEx::OnSysCommand(nID, lParam);
	}
}

// 如果向对话框添加最小化按钮，则需要下面的代码
//  来绘制该图标。对于使用文档/视图模型的 MFC 应用程序，
//  这将由框架自动完成。

void CFileOrgDlg::OnPaint()
{
	if (IsIconic())
	{
		CPaintDC dc(this); // 用于绘制的设备上下文

		SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);

		// 使图标在工作区矩形中居中
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// 绘制图标
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialogEx::OnPaint();
	}
}

//当用户拖动最小化窗口时系统调用此函数取得光标
//显示。
HCURSOR CFileOrgDlg::OnQueryDragIcon()
{
	return static_cast<HCURSOR>(m_hIcon);
}



void CFileOrgDlg::OnBnClickedRenameTest()
{
	CString fpath;
	_fPathRomeo.GetWindowText(fpath);
	if (fpath.GetLength() <= 3)
	{
		AfxGetMainWnd()->SetWindowText(_T("错误: 请选择有效文件."));
		return;
	}
	_lidfc.readLidIniSetFile(fpath);
	_lidfc.autoReindexFile();
	this->_baseListBox.InsertString(-1,_T("输出: 【A】重新编号完成!"));
}

void CFileOrgDlg::OnBnClickedBtnRenameTestJuliet()
{
	CString fpath;
	_fpathJuliet.GetWindowText(fpath);
	if (fpath.GetLength() <= 3)
	{
		AfxGetMainWnd()->SetWindowText(_T("错误: 请选择有效文件."));
		return;
	}
	_lidfc.readLidIniSetFile(fpath);
	_lidfc.autoReindexFile();
	this->_baseListBox.InsertString(-1,_T("输出: 【B】重新编号完成!"));
}
void CFileOrgDlg::OnBnClickedBtnDetectPartAdd()
{
	CString fBasePath;
	CString fPartPath;
	_fpathJuliet.GetWindowText(fBasePath);
	_fPathRomeo.GetWindowText(fPartPath);
	_baseListBox.ResetContent();
	if (fBasePath.GetLength() <= 3)
	{
		AfxGetMainWnd()->SetWindowText(_T("错误: 请选择有效文件."));
		return;
	}
	if (fPartPath.GetLength() <= 3)
	{
		AfxGetMainWnd()->SetWindowText(_T("错误: 请选择有效文件."));
		return;
	}
	_lidfc.readLidIniSetFile(fBasePath);
	//基地的处理//
	lid::FileNodePtrList baseList;
	_lidfc.getRawNameToList(_lidfc.IniFileFolder,&baseList);
	_lidfc.extractNonPrefixFileName(&baseList);
	//拷贝列表的处理.
	_lidfc.clearFileNodeList(&copyList);
	//子部的处理//
	lid::FileNodePtrList partList;
	CString partfolderPath;
	CString partIniFileName;
	lid::splitFpath2_folder_fileFullName(fPartPath, partfolderPath,partIniFileName); 
	_lidfc.getRawNameToList( partfolderPath,&partList);
	_lidfc.extractNonPrefixFileName(&partList);
	for(lid::FileNodePtrListIter iter = partList.begin(); iter !=  partList.end(); ++iter)
	{
		BOOL bFind = FALSE;
		lid::FileNodeType* partData = (lid::FileNodeType*)(*iter);
		for(lid::FileNodePtrListIter iterbase = baseList.begin(); iterbase !=  baseList.end(); ++iterbase)
		{
			lid::FileNodeType* baseData = (lid::FileNodeType*)(*iterbase);
			if (0 == partData->nonPrefixName.CompareNoCase(baseData->nonPrefixName))
			{
				bFind = TRUE;
				break;
			}
		}
		if (FALSE == bFind)
		{
			lid::FileNodeType* nextCopy = new lid::FileNodeType;
			nextCopy->orginName = partfolderPath+partData->orginName;
			nextCopy->reAsignName = _lidfc.IniFileFolder+partData->orginName; //CopyTo
			copyList.push_back(nextCopy);
			_baseListBox.InsertString(-1,partData->nonPrefixName);
		}
	}
	if (0 == copyList.size())
	{
		_baseListBox.InsertString(-1,_T("Nothing to Copy"));
	}
	else
	{
		int nRet = 	AfxMessageBox(_T("拷贝到BASE文件夹?"),MB_OKCANCEL);
		if (1 == nRet)
		{
			static_hCopyThread = CreateThread(NULL, 0, pfnCopyThreadProc, this, 0, NULL);  
#if 0
			bgFileChecker fc;
			_todo.SetRange(1,copyList.size());
			int iPos = 1;
			_todo.SetPos(iPos);
			for(lid::FileNodePtrListIter iter = copyList.begin(); iter !=  copyList.end(); ++iter)
			{
				lid::FileNodeType* copyItemData = (lid::FileNodeType*)(*iter);
				fc.set_filePathFull(copyItemData->orginName);
				fc.shell_copyFileTo(this,copyItemData->reAsignName);
				_todo.SetPos(iPos);
				iPos++;
			}
#endif

		}
	}

	_lidfc.clearFileNodeList(&baseList);
	_lidfc.clearFileNodeList(&partList);
}
/*
在对Base执行完重命名后，最Partial内的文件名进行更新操作.
*/
void CFileOrgDlg::OnBnClickedBtnUpdatePartname()
{  
	CString fBasePath;
	CString fPartPath;
	_fpathJuliet.GetWindowText(fBasePath);
	_fPathRomeo.GetWindowText(fPartPath);
	_baseListBox.ResetContent();
	if (fBasePath.GetLength() <= 3)
	{
		AfxGetMainWnd()->SetWindowText(_T("错误: 请选择有效文件."));
		return;
	}
	if (fPartPath.GetLength() <= 3)
	{
		AfxGetMainWnd()->SetWindowText(_T("错误: 请选择有效文件."));
		return;
	}
	_lidfc.readLidIniSetFile(fBasePath);
	//基地的处理//
	lid::FileNodePtrList baseList;
	_lidfc.getRawNameToList(_lidfc.IniFileFolder,&baseList);
	_lidfc.extractNonPrefixFileName(&baseList);
	//需要重命名的列表//
	lid::FileNodePtrList renameList;
	//子部的处理//
	lid::FileNodePtrList partList;
	CString partfolderPath;
	CString partIniFileName;
	lid::splitFpath2_folder_fileFullName(fPartPath, partfolderPath,partIniFileName); 
	_lidfc.getRawNameToList( partfolderPath,&partList);
	_lidfc.extractNonPrefixFileName(&partList);
	for(lid::FileNodePtrListIter iter = partList.begin(); iter !=  partList.end(); ++iter)
	{
		BOOL bFind = FALSE;
		lid::FileNodeType* partData = (lid::FileNodeType*)(*iter);
		lid::FileNodeType* baseData = NULL;
		for(lid::FileNodePtrListIter iterbase = baseList.begin(); iterbase !=  baseList.end(); ++iterbase)
		{
			baseData = (lid::FileNodeType*)(*iterbase);
			if (0 == partData->nonPrefixName.CompareNoCase(baseData->nonPrefixName))
			{
				bFind = TRUE;
				break;
			}
		}
		if (FALSE == bFind || (baseData==NULL))
		{
			CString str;
			str.Format(_T("UpdatePartName错误.请确认一将part中的文件加入base\n%s"),partData->orginName);
			AfxMessageBox(str);
			return;
		}
		if (bFind)
		{
			if (0 != partData->orginName.CompareNoCase(baseData->orginName) )
			{
				lid::FileNodeType* nextRename = new lid::FileNodeType;
				CString info;
				nextRename->orginName = partfolderPath+partData->orginName;
				nextRename->reAsignName = partfolderPath+baseData->orginName;
				renameList.push_back(nextRename);
				info.Format(_T("[%s]\t\t\t更新为:[%s]"),partData->orginName,baseData->orginName);
				_baseListBox.InsertString(-1,info);
			}
		}
	}
	if (0 == renameList.size())
	{
		_baseListBox.InsertString(-1,_T("[A] Nothing Need to Update Name"));
	}
	else
	{
		int nRet = 	AfxMessageBox(_T("更新A中文件的命名"),MB_OKCANCEL);
		if ( 1 == nRet)
		{
			_todo.SetRange(1,renameList.size());
			int iPos = 1;
			_todo.SetPos(iPos);
			for(lid::FileNodePtrListIter iter = renameList.begin(); iter !=  renameList.end(); ++iter)
			{
				lid::FileNodeType* partData = (lid::FileNodeType*)(*iter);
				lid::RenameFile((LPTSTR)(LPCTSTR)partData->orginName,(LPTSTR)(LPCTSTR)partData->reAsignName);
				iPos++;
			}
			this->_baseListBox.InsertString(-1,_T("输出: 重命名完成!"));
		}
	}

	_lidfc.clearFileNodeList(&baseList);
	_lidfc.clearFileNodeList(&partList);
	_lidfc.clearFileNodeList(&renameList);
}

void CFileOrgDlg::OnBnClickedBtnFindSameSize()
{
	CString fBasePath;
	_fpathJuliet.GetWindowText(fBasePath);
	_baseListBox.ResetContent();
	if (fBasePath.GetLength() <= 3)
	{
		AfxGetMainWnd()->SetWindowText(_T("错误: 请选择有效文件."));
		return;
	}
	//基地的处理//
	_lidfc.readLidIniSetFile(fBasePath);
	lid::FileNodePtrList baseList;
	lid::FileNodeType* baseData;
	bgFileChecker fc;
	CString base_folder;
	CString base_file;
	CString fileFullPath;
	lid::splitFpath2_folder_fileFullName(fBasePath,base_folder,base_file);
	static_LastCheckSizeFolder = base_folder;
	_lidfc.getRawNameToList(_lidfc.IniFileFolder,&baseList);
	for(lid::FileNodePtrListIter iterbase = baseList.begin(); iterbase !=  baseList.end(); ++iterbase)
	{
		baseData = (lid::FileNodeType*)(*iterbase);
		fileFullPath = base_folder+baseData->orginName;
		fc.set_filePathFull(fileFullPath);
		baseData->fsize = fc.get_filesize64();
	}
	baseList.sort(lid::FileNode::cmpFileSizeAscend);
	INT64 prvSize = 0;
	lid::FileNodePtrListIter ITER_END = baseList.end();
	for(lid::FileNodePtrListIter iterbase = baseList.begin(); iterbase !=  baseList.end(); )
	{
		baseData = (lid::FileNodeType*)(*iterbase);
		prvSize = baseData->fsize;

		if(iterbase == ITER_END){break;}else {iterbase++;if (iterbase == ITER_END){break;}};

		if((*iterbase)->fsize == prvSize)
		{
			_baseListBox.InsertString(-1,baseData->orginName);
			_baseListBox.InsertString(-1,(*iterbase)->orginName);
			//查找第2个重复项，并指向第3个元素.
			if(iterbase == ITER_END){break;}else {iterbase++;if (iterbase == ITER_END){break;}};
		}
		while((*iterbase)->fsize == prvSize) //第3个元素+更多.
		{
			_baseListBox.InsertString(-1,(*iterbase)->orginName);
			if(iterbase == ITER_END){break;}else {iterbase++;if (iterbase == ITER_END){break;}};
		}
	}
	_lidfc.clearFileNodeList(&baseList);
	_btnRemoveDupy.EnableWindow(TRUE);
}
void CFileOrgDlg::OnBnClickedBtnRemoveDupy()
{
	CString fBasePath;
	_fpathJuliet.GetWindowText(fBasePath);
	CString base_folder;
	CString base_file;
	CString fileFullPath;
	bgFileChecker fc;
	lid::splitFpath2_folder_fileFullName(fBasePath,base_folder,base_file);
	if (0!=static_LastCheckSizeFolder.CompareNoCase(base_folder))
	{
		_btnRemoveDupy.EnableWindow(FALSE);
		_baseListBox.InsertString(-1,_T("错误:信息已经失效!"));
		return;
	}
	else
	{
		//一下，删除选择的项目.
		int nCount = _baseListBox.GetSelCount();
		CArray<int,int> aryListBoxSel;
		aryListBoxSel.SetSize(nCount);
		_baseListBox.GetSelItems(nCount, aryListBoxSel.GetData()); //获得所有被选中的索引
		for(int i=0; i<nCount; i++)
		{
			CString Temp;
			_baseListBox.GetText(aryListBoxSel[i], Temp);//获得每项的文字保存在Temp
			fileFullPath = base_folder + Temp;
			fc.shell_deleteFile(fileFullPath);
		}
		for(int i= (nCount-1); i>= 0; i--)
		{
			_baseListBox.DeleteString(aryListBoxSel[i]);
		}
		_baseListBox.InsertString(-1,_T("输出:删除文件成功!"));
		return;
	}
}
void CFileOrgDlg::OnBtn_write2file()
{
	static const CString kLogCsv = _T("_flist.csv");
	CString fBasePath;
	_fpathJuliet.GetWindowText(fBasePath);
	_baseListBox.ResetContent();
	if (fBasePath.GetLength() <= 3)
	{
		AfxGetMainWnd()->SetWindowText(_T("错误: 请选择有效文件."));
		return;
	}
	//基地的处理//
	_lidfc.readLidIniSetFile(fBasePath);
	lid::FileNodePtrList baseList;
	lid::FileNodeType* baseData;
	bgFileChecker fc;
	CString base_folder;
	CString base_file;
	CString fileFullPath;
	CString csvFileFullPath;
	CString line;
	CString sizeStr;
	lid::splitFpath2_folder_fileFullName(fBasePath,base_folder,base_file);
	static_LastCheckSizeFolder = base_folder;
	_lidfc.getRawNameToList(_lidfc.IniFileFolder,&baseList);
	//获取文件的大小信息//
	for(lid::FileNodePtrListIter iterbase = baseList.begin(); iterbase !=  baseList.end(); ++iterbase)
	{
		baseData = (lid::FileNodeType*)(*iterbase);
		fileFullPath = base_folder+baseData->orginName;
		fc.set_filePathFull(fileFullPath);
		baseData->fsize = fc.get_filesize64();
	}
	////
	csvFileFullPath = _lidfc.IniFileFolder+kLogCsv;
	rawTextFile file((LPWSTR)(LPCWSTR)csvFileFullPath);
	file.openWriteClear();
	//file.putString(_T("中文"));
	int fileIndex = 1;
	UINT64 fsizeSum = 0;
	int nSize = baseList.size();
	_todo.SetRange(0,nSize);
	_todo.SetPos(nSize*10/5);
	for(lid::FileNodePtrListIter iterbase = baseList.begin(); iterbase !=  baseList.end(); iterbase++)
	{
		baseData = (lid::FileNodeType*)(*iterbase);
		fsizeSum +=baseData->fsize;
		sizeStr = lid::FormatBytes64InternalAutoUnit(baseData->fsize);
		line.Format(_T("%d,%s,%s,"),fileIndex,baseData->orginName,sizeStr); 
		fileIndex++;
		file.putString(line);
		file.linefeed();
	}
	//写总大小的信息//
	sizeStr = lid::FormatBytes64InternalAutoUnit(fsizeSum);
	line.Format(_T(",%s,%s,"),_T("总大小"),sizeStr); 
	file.putString(line);
	////
	_todo.SetPos(nSize);
	OnBnClickedOpenBfolder();
	_baseListBox.InsertString(-1,_T("输出:写文件列表到CSV文件成功!"));
	_todo.SetPos(0);
	//systec::ShellOperation sh;
	//sh.set_exePath(csvFileFullPath);
	//sh.run();
}

void CFileOrgDlg::OnDestroy()
{
	CDialogEx::OnDestroy();
}



void CFileOrgDlg::OnBnClickedBtnSelLibini()
{
	systec::ChooseFileDialog fil;
	fil.set_defaultFolder(kstrDefPath);
	fil.set_fileTypeFillter(kstrFilter);
	fil.showOpenFile();
	CString fpath = fil.get_selectFile();
	if (!fpath.IsEmpty())
	{
		_fPathRomeo.SetWindowText(fpath);
	}
}


void CFileOrgDlg::OnBnClickedBtnSelLibini2()
{
	systec::ChooseFileDialog fil;
	fil.set_defaultFolder(kstrDefPath);
	fil.set_fileTypeFillter(kstrFilter);
	fil.showOpenFile();
	CString fpath = fil.get_selectFile();
	if (!fpath.IsEmpty())
	{
		_fpathJuliet.SetWindowText(fpath);
	}

}

void CFileOrgDlg::OnBnClickedBtnSwitch()
{
	CString sa,sb;
	_fPathRomeo.GetWindowText(sa);
	_fpathJuliet.GetWindowText(sb);
	_fPathRomeo.SetWindowText(sb);
	_fpathJuliet.SetWindowText(sa);
}




void CFileOrgDlg::OnBnClickedBtnSyncBfile2a()
{
	CString sa,sb;
	UpdateData(FALSE);
	_fPathRomeo.GetWindowText(sa);
	_fpathJuliet.GetWindowText(sb);
	bgFileChecker fc;
	fc.set_filePathFull(sb);
	fc.shell_copyFileTo(this,sa);
	this->_baseListBox.InsertString(-1,_T("输出: 同步[B]中的配置文件到[A]成功!"));
}


void CFileOrgDlg::OnBnClickedOpenAfolder()
{
	CString sa;
	_fPathRomeo.GetWindowText(sa);
	CString fd;
	CString tmp;
	lid::splitFpath2_folder_fileFullName(sa,fd,tmp);
	if (fd.GetLength()<=3)
	{
		return;
	}
	systec::ShellOperation sh;
	sh.set_exePath(fd);
	sh.openFolder();
}

void CFileOrgDlg::OnBnClickedOpenBfolder()
{
	CString sa;
	_fpathJuliet.GetWindowText(sa);
	CString fd;
	CString tmp;
	lid::splitFpath2_folder_fileFullName(sa,fd,tmp);
	if (fd.GetLength()<=3)
	{
		return;
	}
	systec::ShellOperation sh;
	sh.set_exePath(fd);
	sh.openFolder(); 
}

